﻿@model CustomerReturnRequestsModel

@using Nop.Core.Domain.Catalog

@inject Nop.Services.Html.IHtmlFormatter htmlFormatter

@{
    Layout = "_ColumnsTwo";

    //title
    NopHtml.AddTitleParts(T("PageTitle.Account").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-account-page");
    NopHtml.AppendPageCssClassParts("html-return-request-list-page");
}
@section left
{
    @await Component.InvokeAsync(typeof(CustomerNavigationViewComponent), new { selectedTabId = CustomerNavigationEnum.ReturnRequests })
}
<div class="page account-page return-request-list-page">
    <div class="page-title">
        <h1>@T("Account.MyAccount") - @T("Account.CustomerReturnRequests")</h1>
    </div>
    <div class="page-body">
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CustomerReturnRequestsTop, additionalData = Model })
        @foreach (var item in Model.Items)
        {
            <div class="section request-item">
                <h2 class="title">
                    @string.Format(T("Account.CustomerReturnRequests.Title").Text, item.CustomNumber, item.ReturnRequestStatus)
                </h2>
                <ul class="details">
                    <li class="product">
                        <label>@T("Account.CustomerReturnRequests.Item")</label>
                        <a href="@(await NopUrl.RouteGenericUrlAsync<Product>(new { SeName = item.ProductSeName }))">@item.ProductName</a>
                        <span>x @item.Quantity</span>
                    </li>
                    <li class="reason">
                        <label>@T("Account.CustomerReturnRequests.Reason")</label>
                        <span>@item.ReturnReason</span>
                    </li>
                    <li class="action">
                        <label>@T("Account.CustomerReturnRequests.Action")</label>
                        <span>@item.ReturnAction</span>
                    </li>
                    <li class="date">
                        <label>@T("Account.CustomerReturnRequests.Date")</label>
                        <span>@item.CreatedOn.ToString()</span>
                    </li>
                    @if (item.UploadedFileGuid != Guid.Empty)
                    {
                        <li class="uploaded-file">
                            <label>@T("Account.CustomerReturnRequests.UploadedFile")</label>
                            <span>
                                <a href="@Url.RouteUrl(NopRouteNames.Standard.DOWNLOAD_GET_FILE_UPLOAD, new { downloadId = item.UploadedFileGuid.ToString() })">
                                    @T("Account.CustomerReturnRequests.UploadedFile.Download")
                                </a>
                            </span>
                        </li>
                    }
                    @if (!string.IsNullOrEmpty(item.Comments))
                    {
                        <li class="comments">
                            <label>@T("Account.CustomerReturnRequests.Comments")</label>
                            <div>@Html.Raw(htmlFormatter.FormatText(item.Comments, false, true, false, false, false, false))</div>
                        </li>
                    }
                </ul>
            </div>
        }
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.CustomerReturnRequestsBottom, additionalData = Model })
    </div>
</div>
